#include"ThreadPool.hpp"

#include<unistd.h>

int main() {
  
  srand((unsigned int)time(nullptr));
  loadCal();
  ThreadPool<Caculator>* tp = new ThreadPool<Caculator>();
  
  tp->RunAllThread();

  while(1) {
    sleep(1);
    int x = rand() % 200 + 1;
    int y = rand() % 100 + 1;
    int index = rand() % 4;
    LogMessage(NORMAL, _F, _L, "主线程派发任务 :: %d %c %d = ?", x, tasks[index].first, y);
    
    tp->PushTask(Caculator(x, y, tasks[index].second, index));
  }

  delete tp;

  return 0;
}
